// import request from '@/router/axiosTask';
import request from '@/router/axios';


export const addMethod = (data) => {
  return request({
    url: '/api/function-api/sysmethod/add',
    method: 'post',
    data: data,
  })
}


export const updateMethod = (data) => {
  return request({
    url: '/api/function-api/sysmethod/update',
    method: 'post',
    data: data,
  })
}

export const getMethodList = (params) => {
  return request({
    url: '/api/function-api/sysmethod/pageList',
    method: 'post',
    params: params
  })
}
export const getMethodLists = (params) => {
  return request({
    url: '/api/function-api/sysmethod/load-methods-byjobgroup',
    method: 'post',
    params: params
  })
}
export const delMethod = (params) => {
  return request({
    url: '/api/function-api/sysmethod/remove',
    method: 'post',
    params: { ...params }
  })
}
export const getServiceList = (params) => {
  return request({
    url: '/api/function-api/jobgroup/pageList',
    method: 'post',
    data: { ...params }
  })
}
// 任务列表
export const getJobList = (params) => {
  return request({
    url: '/api/function-api/jobinfo/pageList',
    method: 'post',
    params: params
  })
}
// 任务新增
export const addJob = (data) => {
  return request({
    url: '/api/function-api/jobinfo/add',
    method: 'post',
    data: data,
  })
}
// 任务更新
export const updateJob = (data) => {
  return request({
    url: '/api/function-api/jobinfo/update',
    method: 'post',
    data: data,
  })
}

// 任务执行一次
export const triggerJob = (data) => {
  return request({
    url: '/api/function-api/jobinfo/trigger',
    method: 'post',
    data: data,
  })
}

// 任务删除
export const removeJob = (data) => {
  return request({
    url: '/api/function-api/jobinfo/remove',
    method: 'post',
    params: data,
  })
}

// 任务开始
export const startJob = (data) => {
  return request({
    url: '/api/function-api/jobinfo/start',
    method: 'post',
    params: data,
  })
}

// 任务停止
export const stopJob = (data) => {
  return request({
    url: '/api/function-api/jobinfo/stop',
    method: 'post',
    params: data,
  })
}

// 下次执行时间
export const nextTriggerTimeJob = (data) => {
  return request({
    url: '/api/function-api/jobinfo/nextTriggerTime',
    method: 'post',
    params: data,
  })
}

//日志列表
export const logList = (params) => {
  return request({
    url: '/api/function-api/joblog/pageList',
    method: 'post',
    params: params
  })
}

//根据服务名称查任务
export const getJobsByGroup = (params) => {
  return request({
    url: '/api/function-api/joblog/getJobsByGroup',
    method: 'post',
    params: params
  })
}


//清理日志
export const clearLog = (params) => {
  return request({
    url: '/api/function-api/joblog/clearLog',
    method: 'post',
    params: params
  })
}